﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Hosting;
using EPiBoost.Core.Helpers.Resources;
using EPiServer.PlugIn;

namespace EPiBoost.Core.Plugins.Gui.Admin
{
	public class RegisterResources : PlugInAttribute
	{

		public const string FilePathCustomRedirects = "~/util/EPiBoost/ManageCustomRedirects.aspx";
		public const string FilePathExceptionViewer = "~/util/EPiBoost/Exception-Viewer-Tool.aspx";
		public const string FilePathView404Exceptions = "~/util/EPiBoost/View404ExceptionList.aspx";  
		 

		public static void Start()
		{
			RegisterVppResources();
		}

		private static void RegisterVppResources()
		{
			if (HttpContext.Current == null)
				return;
			
			HostingEnvironment.RegisterVirtualPathProvider(
				new ResourcePathProvider(System.Web.VirtualPathUtility.ToAbsolute(FilePathCustomRedirects),
				                         "EPiBoost.Core.Plugins.Gui.Admin.CustomRedirects.aspx", false));

			HostingEnvironment.RegisterVirtualPathProvider(
				new ResourcePathProvider(System.Web.VirtualPathUtility.ToAbsolute(FilePathExceptionViewer),
				                         "EPiBoost.Core.Plugins.Gui.Admin.ExceptionViewer.aspx", false));

			HostingEnvironment.RegisterVirtualPathProvider(
				new ResourcePathProvider(System.Web.VirtualPathUtility.ToAbsolute(FilePathView404Exceptions),
				                         "EPiBoost.Core.Plugins.Gui.Admin.View404Exceptions.aspx", false));
		}

	}
}
